<?php

namespace common\models\user;

use Yii;

/**
 * This is the model class for table "{{%user_like}}".
 *
 * @property int $id 喜欢ID
 * @property string $model 喜欢模型：article，thread等
 * @property int $model_id 喜欢内容主键
 * @property int $user_id 用户UID
 * @property int $created_at 喜欢时间
 * @property int $updated_at
 */
class UserLike extends \common\db\ActiveRecord {

    const MODEL_ARTICLE = 'article';
    const MODEL_ARTICLE_COMMENT = 'article_comment';
    const MODEL_DYNAMIC = 'dynamic';
    const MODEL_DYNAMIC_COMMENT = 'dynamic_comment';

    /**
     * @inheritdoc
     */
    public static function tableName() {
        return '{{%user_like}}';
    }

    /**
     * @inheritdoc
     */
    public function rules() {
        return [
            [['model'], 'required'],
            [['model_id', 'parent_id', 'user_id', 'device_id', 'created_at', 'updated_at'], 'integer'],
            [['model'], 'string', 'max' => 50],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels() {
        return [
            'id' => '喜欢ID',
            'model' => '喜欢模型：article，thread等',
            'model_id' => '喜欢内容主键',
            'parent_id' => '父级模型ID',
            'user_id' => '用户UID',
            'device_id' => '设备ID',
            'created_at' => '喜欢时间',
            'updated_at' => 'Updated At',
        ];
    }

}
